/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  							 script_artifact_action.h

	$Header: /heroes4/script_artifact_action.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( SCRIPT_ARTIFACT_ACTION_H_INCLUDED )
#define SCRIPT_ARTIFACT_ACTION_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <iosfwd>
#include <vector>

#include "artifact.h"
#include "script_target_type.h"
#include "script_stack_action.h"

// --------------------------------------------------------------------------
// t_script_artifact_action class
// --------------------------------------------------------------------------

class t_script_artifact_action
	:	public t_script_stack_action
{
public:
	// Types
	typedef std::vector< t_artifact >	t_artifact_list;

	// Member functions
	t_artifact_list const &	get_artifacts() const;

	virtual void	add_icons(t_basic_dialog* dialog) const;

	virtual bool	read_from_map(
						std::streambuf &	stream,
						int					format_version );

	virtual bool	read( std::streambuf& stream, int version );
	virtual bool	write( std::streambuf& stream ) const;

private:
	// Data members
	std::vector< t_artifact >	m_artifacts;

	bool			read_artifacts( std::streambuf& stream );
};

class t_script_take_artifact 
	: public t_script_artifact_action
{
protected:
	virtual void	make_adjustment(t_creature_stack* stack, t_creature_array* owning_array) const;
	virtual void	make_adjustment(t_creature_array* array) const;
};

class t_script_give_artifact 
	: public t_script_artifact_action
{
protected:
	virtual void	make_adjustment(t_creature_stack* stack, t_creature_array* owning_array) const;
	virtual void	make_adjustment(t_creature_array* array) const;
};

// --------------------------------------------------------------------------
// t_script_artifact_action inline members
// --------------------------------------------------------------------------

// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
inline t_script_artifact_action::t_artifact_list const &
t_script_artifact_action::get_artifacts() const
{
	return m_artifacts;
}

SPECIALIZE_SCRIPT_ACTION( k_script_action_give_artifacts, t_script_give_artifact );
SPECIALIZE_SCRIPT_ACTION( k_script_action_take_artifacts, t_script_take_artifact );

#endif // !defined( SCRIPT_ARTIFACT_ACTION_H_INCLUDED )
